public class Test22 {
    /**
     * 目的:获取线程的返回值
     * 方法:使用一个额外的工具人类
     */
    static class Count{
        int con = 0;
    }
    public static void main(String[] args) throws InterruptedException {
        //int tmp = 0;
        Count count = new Count();
        Thread thread = new Thread(){
            @Override
            public void run() {
                synchronized (count){
                    //int tmp = 0;
                    for (int i = 0; i <= 100000 ; i++) {
                        //tmp = i;
                        count.con = i;
                    }
                    count.notify();
                }
            }
        };
        thread.start();
        Thread.sleep(1);
        synchronized (count){
            if (count.con == 0){
                count.wait();
            }
        }
        System.out.println(count.con);
    }
}
